/**
 * Copyright(c) 2013 Jade Techonologies Co., Ltd.
 *
 * History:
 *   14-7-29 下午1:13 Created by dwzhang
 */
package com.jade.framework.base.comm.impl;

import java.net.InetSocketAddress;

import com.jade.framework.base.comm.Protocol;
import com.jade.framework.base.comm.ProtocolSession;
import com.jade.framework.base.comm.ProtocolTransport;
import com.jade.framework.base.util.SimpleParameters;
import org.apache.commons.logging.Log;

/**
 * 简单的协议Session实现。
 *
 * @author dwzhang
 * @version 1.0 14-7-29 下午1:13
 */
public class SimpleSession extends SimpleParameters implements ProtocolSession
{
    protected ProtocolTransport transport;
    protected Protocol protocol;
    public SimpleSession(Protocol protocol, ProtocolTransport transport)
    {
        this.protocol = protocol;
        this.transport = transport;
    }

    public InetSocketAddress getRemoteAddress()
    {
        return transport.getRemoteAddress();
    }

    public InetSocketAddress getLocalAddress()
    {
        return transport.getLocalAddress();
    }

    public ProtocolTransport getTransport()
    {
        return transport;
    }

    public Protocol getProtocol()
    {
        return protocol;
    }

    public Log getLog()
    {
        return protocol == null ? null : protocol.getLog();
    }
}
